libxl: remove get_all_assigned_devices() from libxl_pci.c
authorPaul Durrant <pdurrant@amazon.com>
Tue, 8 Dec 2020 19:30:19 +0000 (19:30 +0000)
committerWei Liu <wl@xen.org>
Tue, 15 Dec 2020 16:24:23 +0000 (16:24 +0000)
commitf8cfb85719b600f3f87a1a3931f292f4335dcce4
tree701072a04e6aa40f30aaeef5db330e128eb43452
parent4951b9ea807d4a4e5a54798d366b2ea3d6ca5060
libxl: remove get_all_assigned_devices() from libxl_pci.c

Use of this function is a very inefficient way to check whether a device
has already been assigned.

This patch adds code that saves the domain id in xenstore at the point of
assignment, and removes it again when the device id de-assigned (or the
domain is destroyed). It is then straightforward to check whether a device
has been assigned by checking whether a device has a saved domain id.

NOTE: To facilitate the xenstore check it is necessary to move the
      pci_info_xs_read() earlier in libxl_pci.c. To keep related functions
      together, the rest of the pci_info_xs_XXX() functions are moved too.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Acked-by: Wei Liu <wl@xen.org>
tools/libs/light/libxl_pci.c